package com.game.majiang.vo;

import java.sql.SQLException;
import java.util.HashMap;

import javax.sql.rowset.CachedRowSet;

import com.game.server.db.Parameter;
import com.game.server.db.SqlHelper;

public class everydaysignVo {
	
	public int id = 0;
	public int gold = 0;
	public int probabilitymin = 0;
	public int probabilitymax = 0;
	
	public boolean check(int val)
	{
		boolean flag = false;
		if(val >= probabilitymin && val<= probabilitymax)
		{
			flag = true;
		}
		return flag;
	}

	public static HashMap<Integer, everydaysignVo> GeteverydaysignVo()
	{
		HashMap<Integer, everydaysignVo> map = new HashMap<Integer, everydaysignVo>();
		String cmdText = "select g.id, g.gold, g.probabilitymin, g.probabilitymax from everydaysign g";
    	CachedRowSet rs = SqlHelper.getResultSet(cmdText, new Parameter[0]);
    	try {
    		  while (rs.next())
	          {
    			  everydaysignVo vo = new everydaysignVo();
	             vo.id = rs.getInt(1);
	             vo.gold = rs.getInt(2);
	             vo.probabilitymin = rs.getInt(3);
	             vo.probabilitymax = rs.getInt(4);
	             map.put(vo.id, vo);
	         }
		 } catch (SQLException e) {
			// TODO Auto-generated catch block
			 e.printStackTrace();
		 }
		return map;
	}
}
